﻿using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TestConsole;

namespace ReForm.Shared.Pages
{
    public partial class DyncNewForm
    {
        [Parameter]
        public IList<FormControlBase> Controls { get; set; }

        private List<SelectedItem> GetSelectedItemsForInput(InputInfo group)
        {
           return  group.Children.Select(i => new SelectedItem
            {
                Text = i.Label,
                Value = i.Label
            }).ToList();
        }

        /// <summary>
        /// 获取下拉框数据源
        /// </summary>
        /// <param name="select"></param>
        /// <returns></returns>
        private List<SelectedItem> GetSelectedItemsForSelect(SelectInfo select)
        {
            return select.Options.Select(o => new SelectedItem
            {
                Text = o.Text,
                Value = o.Value
            }).ToList();
        }
    }
}
